module("map", package.seeall);

local Piece = require("piece");
local piece = Piece:Piece();

local Rope = require("rope");
local rope = Rope:Rope();

function Map()
    local map = {};
    local tileNumber = 16;
    local ropeSize = 6;
    pieceref = 0;
    pieceRef2 = 0;

    local bone = display.newImage("Assets/bone.png");
    function map:lv1()
        map.lvl1={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
        for i = 1, tileNumber do
            for j = 1 , tileNumber do
                    if(map.lvl1[i][j] == 1)then
                        piece:pieceImage(i, j);
                        pieceref = piece[i];
                        bone.x, bone.y = i * 30, j * 32 + 145;
                    end
             end
        end

        for k = 1, ropeSize do
        rope:RopeBuild(ropeSize, x, y, k, pieceref, bone);
        end

    end
    return map;
end